package com.ruoyi.app.controller.order.mapper;

import com.ruoyi.common.core.dao.BaseMapper;
import com.ruoyi.common.entity.DO.order.ShopCreditOrderDO;
import com.ruoyi.common.entity.VO.order.ShopOrderSearchVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface IShopCreditOrderMapper extends BaseMapper<ShopCreditOrderDO> {

    List<ShopCreditOrderDO> searchList(ShopOrderSearchVO shopOrderSearchVO);

    @Select("SELECT COUNT(1) FROM shop_credit_order where member_id=#{memberId} and order_status=#{status} and is_enable=1 and is_delete=0")
    int countByStatus(@Param("memberId") long memberId, @Param("status") Integer status);

    @Select("SELECT COUNT(1) FROM shop_credit_order where member_id=#{memberId} and is_enable=1 and is_delete=0")
    int countTotal(@Param("memberId") long memberId);

    @Select("SELECT COUNT(1) FROM shop_credit_order where member_id=#{memberId} and order_status=0 and is_enable=1 and is_delete=0")
    int getPreExchangeNum(@Param("memberId") long memberId);

}
